package com.ruoyi.project.rm.pojo;


import java.util.List;

/**
 * 声明实体类存储分页查询结果
 * @param <T>
 */

public class DataResult<T> {
    private List<T> rows;
    private Long total;

    public DataResult() {
    }

    public DataResult(List<T> rows, Long total) {
        this.rows = rows;
        this.total = total;
    }

    @Override
    public String toString() {
        return "DataResult{" +
                "rows=" + rows +
                ", total=" + total +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DataResult<?> that = (DataResult<?>) o;

        if (rows != null ? !rows.equals(that.rows) : that.rows != null) return false;
        return total != null ? total.equals(that.total) : that.total == null;
    }

    @Override
    public int hashCode() {
        int result = rows != null ? rows.hashCode() : 0;
        result = 31 * result + (total != null ? total.hashCode() : 0);
        return result;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }
}
